From e386da97d105491c7bbea5086d551ae3a78c096b Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 27 Jul 2005 11:20:47 +0000 Subject: [PATCH] On opt_nosmp, also force num_cores to 1. Do this in setup.c instead of cpu/common.c. This is where opt_nosmp is defined, and it reduces diff of cpu/ subdir against native Linux. Signed-off-by: Keir Fraser --- xen/arch/x86/cpu/common.c | 9 ++------- xen/arch/x86/setup.c | 7 ++++++- xen/common/domain.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 13628447aa..49661af7d8 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -427,17 +427,12 @@ void __init detect_ht(struct cpuinfo_x86 *c) u32 eax, ebx, ecx, edx; int index_msb, tmp; int cpu = smp_processor_id(); - extern int opt_nosmp; if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) return; - if (opt_nosmp) { - smp_num_siblings = 1; - } else { - cpuid(1, &eax, &ebx, &ecx, &edx); - smp_num_siblings = (ebx & 0xff0000) >> 16; - } + cpuid(1, &eax, &ebx, &ecx, &edx); + smp_num_siblings = (ebx & 0xff0000) >> 16; if (smp_num_siblings == 1) { printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index ed010f88dc..dba4b54760 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -35,7 +35,7 @@ integer_param("xenheap_megabytes", opt_xenheap_megabytes); #endif /* opt_nosmp: If true, secondary processors are ignored. */ -int opt_nosmp = 0; +static int opt_nosmp = 0; boolean_param("nosmp", opt_nosmp); /* maxcpus: maximum number of CPUs to activate. */ @@ -197,7 +197,12 @@ static void __init start_of_day(void) set_in_cr4(X86_CR4_OSXMMEXCPT); if ( opt_nosmp ) + { max_cpus = 0; + smp_num_siblings = 1; + boot_cpu_data.x86_num_cores = 1; + } + smp_prepare_cpus(max_cpus); /* We aren't hotplug-capable yet. */ diff --git a/xen/common/domain.c b/xen/common/domain.c index f83900a0c6..b939d90f77 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -39,8 +39,8 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu) atomic_set(&d->refcnt, 1); atomic_set(&v->pausecnt, 0); - d->domain_id = dom_id; - v->processor = cpu; + d->domain_id = dom_id; + v->processor = cpu; spin_lock_init(&d->big_lock); -- 2.30.2